package com.hxz.djbxkj.HxzExecutor.Model;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.TimeUnit;

public class InitExcutorMode {
    /**默认配置**/
    private int corePoolSize=50;
    private int maximumPoolSize=50;
    private long keepAliveTime=60l;
    private TimeUnit unit=TimeUnit.SECONDS;
    private BlockingQueue<Runnable> workQueue=new LinkedBlockingDeque<>();
    private RejectedExecutionHandler handler=null;

    public int getCorePoolSize() {
        return corePoolSize;
    }

    public InitExcutorMode setCorePoolSize(int corePoolSize) {
        this.corePoolSize = corePoolSize;
        return this;
    }

    public int getMaximumPoolSize() {
        return maximumPoolSize;
    }

    public InitExcutorMode setMaximumPoolSize(int maximumPoolSize) {
        this.maximumPoolSize = maximumPoolSize;
        return this;
    }

    public long getKeepAliveTime() {
        return keepAliveTime;
    }

    public InitExcutorMode setKeepAliveTime(long keepAliveTime) {
        this.keepAliveTime = keepAliveTime;
        return this;
    }

    public TimeUnit getUnit() {
        return unit;
    }

    public InitExcutorMode setUnit(TimeUnit unit) {
        this.unit = unit;
        return this;
    }

    public BlockingQueue<Runnable> getWorkQueue() {
        return workQueue;
    }

    public InitExcutorMode setWorkQueue(BlockingQueue<Runnable> workQueue) {
        this.workQueue = workQueue;
        return this;
    }

    public RejectedExecutionHandler getHandler() {
        return handler;
    }

    public void setHandler(RejectedExecutionHandler handler) {
        this.handler = handler;
    }
}
